//
//  BPWiFiUploadManager.h
//  BPTV
//
//  Created by baipeng on 2018/11/16.
//  Copyright © 2018年 Apple Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <HTTPServer.h>
#import "BPConst.h"
#import "BPIPHelper.h"

/*
 *  Callback Blocks
 */
typedef void (^BPWiFiUploadManagerFileUploadStartBlock)(NSString *fileName, NSString *savePath);
typedef void (^BPWiFiUploadManagerFileUploadProgressBlock)(NSString *fileName, NSString *savePath, CGFloat progress);
typedef void (^BPWiFiUploadManagerFileUploadFinishBlock)(NSString *fileName, NSString *savePath);


@interface BPWiFiUploadManager : NSObject
@property (nonatomic, strong) HTTPServer *httpServer;
@property (nonatomic, copy) NSString *savePath;
@property (nonatomic, copy) NSString *webPath;

+ (instancetype)shareInstance;

- (BOOL)startHTTPServerAtPort:(UInt16)port;
- (void)stopHTTPServer;
- (BOOL)isServerRunning;
- (NSString *)ip;
- (UInt16)port;
- (BOOL)startHTTPServerAtPort:(UInt16)port
                        start:(BPWiFiUploadManagerFileUploadStartBlock)start
                     progress:(BPWiFiUploadManagerFileUploadProgressBlock)progress
                       finish:(BPWiFiUploadManagerFileUploadFinishBlock)finish;

- (void)showWiFiPageFrontViewController:(UIViewController *)viewController dismiss:(void (^)(void))dismiss;


- (void)setFileUploadStartCallback:(BPWiFiUploadManagerFileUploadStartBlock)callback;
- (void)setFileUploadProgressCallback:(BPWiFiUploadManagerFileUploadProgressBlock)callback;
- (void)setFileUploadFinishCallback:(BPWiFiUploadManagerFileUploadFinishBlock)callback;



@end

